import tensorflow as tf
# a=tf.constant([1,5],dtype=tf.int64)
# print(a) #tf.Tensor([1 5], shape=(2,), dtype=int64)
# print(a.shape) #(2,)
# print(a.dtype) <dtype: 'int64'>

import numpy as np
# a=np.arange(0,5)
# b=tf.convert_to_tensor(a,dtype=tf.int64)
# print(a) # [0 1 2 3 4]
# print(b) # tf.Tensor([0 1 2 3 4], shape=(5,), dtype=int64)

# print(tf.zeros([2,3]))
# # tf.Tensor(
# # [[0. 0. 0.]
# #  [0. 0. 0.]], shape=(2, 3), dtype=float32)
# print(tf.ones([2,3,4]))
# # tf.Tensor(
# # [[[1. 1. 1. 1.]
# #   [1. 1. 1. 1.]
# #   [1. 1. 1. 1.]]
# #
# #  [[1. 1. 1. 1.]
# #   [1. 1. 1. 1.]
# #   [1. 1. 1. 1.]]], shape=(2, 3, 4), dtype=float32)
# print(tf.fill([2,2],9))
# # tf.Tensor(
# # [[9 9]
# #  [9 9]], shape=(2, 2), dtype=int32)

# # 0.5为均值，1为标准差的正态分布
# print(tf.random.normal([4,4],mean=0.5,stddev=1))
# # tf.Tensor(
# # [[ 0.6330607   0.05926949  0.41720942  0.00813103]
# #  [ 1.126138   -0.06380868  0.8863338   1.3882954 ]
# #  [-0.5683373  -0.76549196  0.36300063 -0.5828264 ]
# #  [-0.4416377   0.12727258  0.06196997  0.9601559 ]], shape=(4, 4), dtype=float32)
#
# # 0.5为均值，1为标准差的随机数
# print(tf.random.truncated_normal([4,4],mean=0.5,stddev=1))
# # tf.Tensor(
# # [[ 0.04863513  1.4434018   1.6623243   2.1139975 ]
# #  [ 0.3317726  -0.66411185  0.7126148   1.8514023 ]
# #  [ 2.141483    1.5111231   1.7129694   1.0344958 ]
# #  [-0.8121071  -0.4217115  -0.2870406   2.4558    ]], shape=(4, 4), dtype=float32)

# # 指定维度的均匀分布的随机数[0-1) 前闭后开区间
# print(tf.random.uniform([2,2],minval=0,maxval=1))
# # tf.Tensor(
# # [[0.19819713 0.04952919]
# #  [0.96398604 0.84713256]], shape=(2, 2), dtype=float32)


